home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Interactive Reference Guide / C-C++ Interactive Reference Guide.iso / c_ref / csource2 / sclib_1 / 1_2 / v7n2084c.txt < prev    next >
Encoding:
Text File  |  1995-11-01  |  613 b   |  20 lines

  1. /[()\[\]{}]/
  2.         {
  3.             parens = parens + match( $0, @(@ );
  4.             parens = parens - match( $0, @'('@ );
  5.             parens = parens - match( $0, @)@ );
  6.             parens = parens + match( $0, @')'@ );
  7.             bracks = bracks + match( $0, @[@ );
  8.             bracks = bracks - match( $0, @'['@ );
  9.             bracks = bracks - match( $0, @]@ );
  10.             bracks = bracks + match( $0, @']'@ );
  11.             braces = braces + match( $0, @\{@ );
  12.             braces = braces - match( $0, @'\{'@ );
  13.             braces = braces - match( $0, @\}@ );
  14.             braces = braces + match( $0, @'\}'@ );
  15.         }
  16.         END { printf("parens=%d, brackets=%d, braces=%d\n",
  17.                 parens, bracks, braces );
  18.         }
  19.  
  20.